package com.biz.primus.ms.homepage.trans;

import com.biz.primus.homepage.vo.ProgramRoVo;
import com.biz.primus.ms.homepage.dao.ro.ProgramRo;
import com.google.common.base.Function;
import org.springframework.beans.BeanUtils;

/**
 * Created by jiangnan on 2017/7/13.
 */
public class ProgramRo2ProgramRoVo implements Function<ProgramRo,ProgramRoVo> {

    @Override
    public ProgramRoVo apply(ProgramRo programRo) {
        ProgramRoVo programRoVo = new ProgramRoVo();
        BeanUtils.copyProperties(programRo,programRoVo);
        programRoVo.setId(programRo.getId());
        if (programRo.getParent()!=null){
            programRoVo.setParent(new ProgramRo2ProgramRoVo().apply(programRo.getParent()));
        }
        return programRoVo;
    }
}
